import request from '/@/utils/request';

import qs from 'qs'


export function useBlockApi() {
    return {

        /**
         * 获取erc20持仓列表
         * @param params 
         * @returns 
         */
        getErc20List(params:any, page:Number, limit:Number, sorts:any) {
            let url = `/CHAIN-EVENT-SCAN-APP/admin/tran/getErc20List?page=${page}&limit=${limit}&sorts=${sorts}`;
            return request({
                url: url,
                method: "post",
                data: params,
            });
        },
        // getErc20List(params:any) {

        // },

        /**
        * 获取erc20转账列表
        * @param params 
        * @returns 
        */
        getErc20TokenTransRecord(limit: any, page: any, params: any,sorts: any) {
            return request({
                url: `/CHAIN-EVENT-SCAN-APP/admin/tran/getErc20TokenTransRecord?limit=${limit}&page=${page}&sorts=${sorts}`,
                method: "post",
                data: params,
            });
        },

        /**
        * 获取NFT记录
        * @param params 
        * @returns 
        */
        getNFTList(params: any) {
            return request({
                url: `/CHAIN-EVENT-SCAN-APP/admin/tran/getNFTList`,
                method: "post",
                data: params,
            });
        },

        /**
        * 获取NFT交易记录
        * @param params 
        * @returns 
        */
        getNFTTranList(params: any) {
            return request({
                url: `/CHAIN-EVENT-SCAN-APP/admin/tran/getNFTTranList`,
                method: "post",
                data: params,
            });
        },

        /**
        * 获取Swap交易列表
        * @param params 
        * @returns 
        */
        getSwapTokenRecord(limit: any, page: any, params: any,sorts: any) {
            return request({
                url: `/${_business_app_name}/admin/tran/getSwapTokenRecord?limit=${limit}&page=${page}&sorts=${sorts}`,
                method: "post",
                data: params,
            });
        },


        /**
        * 获取交易记录
        * @param params 
        * @returns 
        */
        getTranLogList(params: any,sorts:any) {
            return request({
                url: `/CHAIN-EVENT-SCAN-APP/admin/contract/logs/list?sorts=${sorts}`,
                method: "post",
                data: params,
            });
        },

        /**
        * 添加合约配置
        * @param params 
        * @returns 
        */
        addContract(params: any) {
            return request({
                url: `/CHAIN-EVENT-SCAN-APP/admin/contract/addContract`,
                method: "post",
                data: params,
            });
        },
 
        /**
        * 获取合约配置
        * @param params 
        * @returns 
        */
        getContractList(params:any) {
            let objStr = qs.stringify(params);
            return request({
                url:`/CHAIN-EVENT-SCAN-APP/admin/contract/getContractList?${objStr}`,
                method: "post",
               
            });
        },

        /**
        * 编辑合约配置
        * @param params 
        * @returns 
        */
        updateContract(params: any) {
            return request({
                url: `/CHAIN-EVENT-SCAN-APP/admin/contract/updateContract`,
                method: "post",
                data: params,
            });
        },

        /**
        * 合约 启用禁用
        * @param params 
        * @returns 
        */
        updateStatus(params:any) {
            let objStr = qs.stringify(params);
            return request({
                url:`/CHAIN-EVENT-SCAN-APP/admin/contract/updateStatus?${objStr}`,
                method: "post",
            });
        },


    }


}